<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加客户</title>
<link rel="stylesheet" type="text/css" href="admin/css/style.css" />
<link rel="stylesheet" type="text/css" media="all" href="admin/css/niceforms-default.css" />
<link rel="stylesheet" type="text/css" media="all" href="admin/js/date/jquery-ui-1.8.16.custom.css" />
<script type="text/javascript" src="admin/js/jquery.min.js"></script>
<script type="text/javascript" src="admin/js/niceforms.js"></script>
<script type="text/javascript" src="admin/js/ddaccordion.js"></script>
<script type="text/javascript" src="admin/js/jconfirmaction.jquery.js"></script>
<script type="text/javascript" src="admin/js/jquery.jclock-1.2.0.js"></script>
<script type="text/javascript" src="admin/js/date/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="admin/js/date/jquery.ui.datepicker-zh-CN.js"></script>
<script type="text/javascript" src="admin/js/area/PCASClass.js" charset="gbk"></script>
<script type="text/javascript">
ddaccordion.init({
	headerclass: "submenuheader", //Shared CSS class name of headers group
	contentclass: "submenu", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [4], //index of content(s) open by default [index1, index2, etc] [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["suffix", "<img src='<%=basePath%>admin/images/plus.gif' class='statusicon' />", "<img src='<%=basePath%>admin/images/minus.gif' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
});
</script>
<script type="text/javascript">
	$(document).ready(function() {
	    $('.jclock').jclock();
	    
		$("#birth").datepicker( {
			changeMonth : true,
			changeYear : true,
			dateFormat : 'yy-mm-dd'
		});
		
	});
	
	function addUser() 
	{
		var name = document.getElementById("name").value;
		var mobile = document.getElementById("mobile").value;
		var tel = document.getElementById("tel").value;
		var email = document.getElementById("email").value;
		var birth = document.getElementById("birth").value;
		var province = document.getElementById("province").value;
		var idcardType = document.getElementById("idcardType").value;
		var IdCard = document.getElementById("IdCard").value;
	//	var birthdayReminder=document.getElementById("birthdayReminder").value;
		if (name.trim() == "") 
		{
			$("#error").text("请填写姓名!");
			return ;
		}
		if (mobile.trim() != "") 
		{
				 var m=/^((13[0-9]{1})|15[0-9]{1})+\d{8}$/;
				  if(!m.test(mobile))
	           		{
					  $("#error").text('提示\n\n请输入有效的手机号码！');
					   return ;
	        		 }
		}
		else
		{
			$("#error").text("请填写有效的手机号码!");
			return ;
		}
		if(email.trim() != "")
		{
			var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
	        if(!myreg.test(email))
	        {
              $("#error").text('提示\n\n请输入有效的E_mail！');
               return ;
	         }
		}
		else{	
			$("#error").text("请输入正确的邮箱！");
			return ;
		}
	   
	    	if(idcardType=="-1")
		{
			$("#error").text("请选择证件类型!");
			return ;
		}
		if(IdCard.trim() != "")
		{
			if(idcardType=="0")
			{
				 var checkFlag = new clsIDCard(IdCard);
				  if (!checkFlag.IsValid()) {
				  $("#error").text("输入的身份证号无效,请输入真实的身份证号！");
				   return ;
				  }
			}
		}
		else{
			$("#error").text("请输入证件号码!");
			return ;
		}
	   
		if (birth == "")
		{
			$("#error").text("请选择出生日期!");
			return ;
		}
		if (province.length <= 0)
		{
			$("#error").text("请选择省份!");
			return ;
		}
		
		$("#addForm").submit();
	
	}
</script>
</head>

<body>
<div id="main_container">
       <%@include file="../header.jsp"%>
    <div class="main_content">
       <%@include file="menu.jsp"%>
   		 <div class="center_content">  
  		  <div class="left_content">
  				   <%@include file="sidebarmenu_sys.jsp"%>
    	  </div>  
    	
		    <div class="right_content">            
		        
		    	<h5>当前位置: 卡系统 &gt; 客户管理&gt; 添加客户</h5>  
		      
		        
		        <form action="customerAction!addCustomerAction" id="addForm" name="addForm" method="post">
				<table id="rounded-corner" summary="2007 Major IT Companies' Profit">
				    <thead>
				    	<tr>
				        	<th scope="col" class="rounded-company"></th>
				            <th scope="col" class="rounded" ></th>
				            <th scope="col" class="rounded" width="20%" align="right">添加客户</th>
				            <th scope="col" class="rounded"></th>
				            <th scope="col" class="rounded"></th>
				            <th scope="col" class="rounded-q4" width="5%"></th>
				        </tr>
				    </thead>
			        <tfoot>
			    		<tr>
			    			<td  class="rounded-foot-left"></td>
				        	<td></td>
				        	<td colspan="2" style="text-align: left;">
				        	</td>
				        	<td></td>
				        	<td class="rounded-foot-right">&nbsp;</td>
				        </tr>
				    </tfoot>
				    <tbody>
				    	<tr>
				    		<td colspan="6"></td>
				    	</tr>
				    	<tr>
				            <td align="right">名称：</td>
			            	<td align="left"><input type="text" name="customer.name" id="name"  size="24"  /></td>
				            <td align="right">手机：</td>
				            <td align="left">
				            	<input type="text" name="customer.mobile" id="mobile" size="24"/>
				            </td>
				             <td colspan="2"></td>
				        </tr>   
				        <tr>
				        		
				        	 <td align="right">固定电话：</td>
			            	<td align="left"><input type="text" name="customer.tel"  id="tel" value="" size="24" /></td>
				            <td align="right">地址：</td>
				            <td align="left"><input type="text" name="customer.address" id="address"  size="24" /></td>
				      		 <td colspan="2"></td>
				        </tr>
				        <tr>
				            <td align="right">证件类型：</td>
				           <td align="left">
				           		<s:select list="#application.dics.DIC_CERTIFICATE_TYPE" listKey="value" listValue="name" name="customer.certificateType" headerKey="-1" headerValue=" -- 请选择 -- "  id="idcardType" theme="simple" cssStyle="font-size:12px;"></s:select>
				           	</td>
				            <td align="right">证件号码：</td>
				            <td align="left"><input type="text" name="customer.certificateNo" id="IdCard" value="" size="24" maxlength="30" /></td>
				      		 <td colspan="2"></td>
				        </tr> 
				        <tr>
				        	 <td align="right">出生日期：</td>
				           <td align="left">
				           		 <input type="text" name="customer.birthday" id="birth" value="" size="24" maxlength="30" />
				           	</td>
				            <td align="right">电子邮箱：</td>
				            <td align="left"><input type="text" name="customer.email" id="email" value="" size="24" maxlength="30" /></td>
				      		 <td colspan="2"></td>
				        </tr> 
				        </tr> 
				        <tr>
				        	 <td align="right">邮编：</td>
				           <td align="left">
								 <input type="text" name="customer.postCode" id="postCode" value="" size="24" maxlength="30" />
				           	</td>
				           	 <td align="right">所在省：</td>
				           <td align="left">
								<select  id="province" name="customer.areaProvince"></select>
				           	</td>
				      		 <td colspan="2"></td>
				        </tr> 
				        <tr>
				           	 <td align="right">所在市：</td>
				            <td align="left">
				            	<select  id="city" name="customer.areaCity"></select>
				           	</td>
				        	 <td align="right">所在地区：</td>
				            <td align="left">
				            	<select  id="district" name="customer.areaDistrict"></select>
				           	</td>
				      		 <td colspan="2"></td>
				        </tr> 
				        <tr>
				           	<td align="right">备注：</td>
				            <td align="left">
				           		 <input type="text" name="customer.customerDesc" id="desc" value="" size="24" maxlength="30" />
				           	</td>
				      		 <td colspan="2"><span id="error" class="error"><s:fielderror value="msg"></s:fielderror></span></td>
				        </tr> 
				        <tr>
				        	<td colspan="1"></td>
				            <td>
				            	<a href="javascript:addUser();" class="bt_blue">
		         					<span class="bt_blue_lft"></span><strong>提交</strong><span class="bt_blue_r"></span>
		        				</a>
				            </td>
				            <td>
				            	<a href="javascript:history.back(-1);" class="bt_blue">
		         					<span class="bt_blue_lft"></span><strong>返回</strong><span class="bt_blue_r"></span>
		        				</a>
				            </td>
				            <td colspan="3"></td>
				        </tr>  
				    </tbody>
				</table>
				</form>
		     
			</div>  <!-- end of right content-->
                    
		</div>  <!--end of center content -->               
    
		<div class="clear"></div>
	
    </div>  <!--end of main content-->
	
    
    <%@include file="../footer.jsp" %>

</div>	
<script language="javascript">
     	var p =" ";
     	var c =" ";
     	var a =" ";
    	p =  "${customer.areaProvince}";
		c = "${customer.areaCity}";
	    a = "${customer.areaDistrict}";
   		 new PCAS("province","city","district",p,c,a);
</script>	
</body>
</html>